package servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;

import dao.ScoreDao;
import dao.StudentDao;
import vo.Score;

public class OP_ManageScoreServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
				ScoreDao ScoDao = new ScoreDao();
				try {
					Score[] ScoArray = ScoDao.getScoreRecords();
					Gson gson = new Gson();
					String jsonString = gson.toJson(ScoArray);
					System.out.print(gson.toJson(ScoArray));
					req.getSession().setAttribute("op_sco_json", jsonString);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				req.getRequestDispatcher("/jsp/op/op_score.jsp").forward(req, resp);//
	}

}
